/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2021-12-06 17:18:37
 * @LastEditTime: 2021-12-06 17:36:29
 * @LastEditors: 赵大壮
 */
import { Component, Vue, Inject } from "vue-property-decorator";
import UiDialogAddVideoType from "@/components/ui-dialog/UiDialogAddVideoType.vue"
import DZServiceVideo from "../../service/DZServiceVideo";
import DZModelType from "../../model/DZModelVideoType";
import dzMsgBox from "@/utils/DZMessageBox";
@Component({
    components: { UiDialogAddVideoType }
})
export default class Index extends Vue {

    s_video = new DZServiceVideo();

    dialog_add_type = false;

    created() { }

    mounted() {
        this.s_video.net_list_type(1);
    }

    beforeDestroy() {

    }

    action_page_change(cur_page) {
        this.s_video.m_page.page = cur_page;
        this.s_video.net_list_type(cur_page);
    }

    action_add_type(item: DZModelType) {
        this.s_video.m_type = JSON.parse(JSON.stringify(item));
        if (this.s_video.m_type.id && this.s_video.m_type.id != '') {
            this.s_video.net_edit_type(() => {
                this.s_video.net_list_type(1);
            });
        } else {
            this.s_video.net_add_type(() => {
                this.s_video.net_list_type(1);
            });
        }
    }

    action_edit_type(item: DZModelType) {
        this.s_video.m_type = JSON.parse(JSON.stringify(item));
        this.dialog_add_type = true;
    }

    action_del_type(item: DZModelType) {
        this.s_video.m_type.id = item.id;
        dzMsgBox.del("是否删除该分类？", () => {
            this.s_video.net_del_type(() => {
                this.s_video.net_list_type(1);
            })
        })

    }
}